Skip to content

Conversation

@sebthom
Copy link
Contributor

@sebthom sebthom commented Oct 26, 2025

This PR implements the ability to optionally reuse the last opened editor (if non-dirty) when opening files from the Project Explorer. This has a similar UX to opening files from the search result view and when single click mode is enabled how vscode opens files.

Animation

This PR addresses #1692

When the JDT Plugin is installed in Eclipse it "hijacks" the OpenActions provider and file opening goes through org.eclipse.jdt.internal.ui.navigator.PackageExplorerOpenActionProvider instead of org.eclipse.ui.internal.navigator.resources.actions.OpenActionProvider which does not apply the new logic. Therefore I added/configured an OpenFileWithReuseActionProvider that depends on the provider of the JDT (i.e. only activates when JDT is present) and wraps it so that opening of IFile is handled as expected.

@sebthom sebthom force-pushed the reuse-last-opened-editor branch from cd4ffb6 to 006f657 Compare October 26, 2025 21:18
@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2025

Test Results

0 files   -  3 018  0 suites   - 3 018   0s ⏱️ - 2h 19m 15s
0 tests  -  8 233  0 ✅  -  7 984  0 💤  - 249  0 ❌ ±0 
0 runs   - 23 619  0 ✅  - 22 825  0 💤  - 794  0 ❌ ±0 

Results for commit 7b0069f. ± Comparison against base commit ce17c9e.

♻️ This comment has been updated with latest results.

@sebthom sebthom force-pushed the reuse-last-opened-editor branch from 49e8d6e to 7b0069f Compare October 26, 2025 21:53
Adds `OpenFileWithReuseActionProvider` that wraps the current OPEN
handler (dependsOn org.eclipse.jdt.ui.navigator.actions.OpenActions) and
installs a wrapper OPEN action in Project Explorer.
For single IFile selections (pref enabled), reuse the last editor via
`OpenFileWithReuseAction`. For all other selections (e.g.,
IJavaElement), delegate to the previously installed OPEN handler (JDT's
OpenAction), preserving Java behavior.
@sebthom sebthom closed this Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant